Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
is-absolute
Advanced tools
Polyfill for node.js `path.isAbolute`. Returns true if a file path is absolute.
The is-absolute npm package is a utility that helps determine if a given file path is an absolute path. This can be particularly useful in file system operations where the distinction between absolute and relative paths is important.
Check if a path is absolute
This feature allows you to check if a given path is absolute. An absolute path is one that starts from the root directory, as opposed to a relative path which is relative to the current working directory.
const isAbsolute = require('is-absolute');
console.log(isAbsolute('/home/user')); // true
console.log(isAbsolute('home/user')); // false
The path-is-absolute package provides similar functionality to is-absolute by determining if a given path is absolute. It is a lightweight package and can be used as a drop-in replacement for is-absolute.
The path module is a core Node.js module that provides utilities for working with file and directory paths. It includes a method called path.isAbsolute() which can be used to check if a path is absolute. This module offers a broader range of path-related utilities compared to is-absolute.
Polyfill for node.js
path.isAbolute
. Returns true if a file path is absolute.
Install with npm:
$ npm install --save is-absolute
Originally based on the isAbsolute
utility method in express.
var isAbsolute = require('is-absolute');
isAbsolute('a/b/c.js');
//=> 'false'
isAbsolute('/a/b/c.js');
//=> 'true'
Explicitly test windows paths
isAbsolute.posix('/foo/bar');
isAbsolute.posix('/user/docs/Letter.txt');
//=> true
isAbsolute.posix('foo/bar');
//=> false
Explicitly test windows paths
var isAbsolute = require('is-absolute');
isAbsolute.win32('c:\\');
isAbsolute.win32('//C://user\\docs\\Letter.txt');
isAbsolute.win32('\\\\unc\\share');
isAbsolute.win32('\\\\unc\\share\\foo');
isAbsolute.win32('\\\\unc\\share\\foo\\');
isAbsolute.win32('\\\\unc\\share\\foo\\bar');
isAbsolute.win32('\\\\unc\\share\\foo\\bar\\');
isAbsolute.win32('\\\\unc\\share\\foo\\bar\\baz');
//=> true
isAbsolute.win32('a:foo/a/b/c/d');
isAbsolute.win32(':\\');
isAbsolute.win32('foo\\bar\\baz');
isAbsolute.win32('foo\\bar\\baz\\');
//=> false
true
if the given string looks like a glob pattern or an extglob pattern… more | homepagetrue
if the path appears to be relative. | homepagePull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Commits | Contributor |
---|---|
31 | jonschlinkert |
1 | es128 |
1 | shinnn |
(This document was generated by verb-generate-readme (a verb generator), please don't edit the readme directly. Any changes to the readme must be made in .verb.md.)
To generate the readme and API documentation with verb:
$ npm install -g verb verb-generate-readme && verb
Install dev dependencies:
$ npm install -d && npm test
Jon Schlinkert
Copyright © 2016, Jon Schlinkert. Released under the MIT license.
This file was generated by verb-generate-readme, v0.1.31, on October 16, 2016.
FAQs
Returns true if a file path is absolute. Does not rely on the path module and can be used as a polyfill for node.js native `path.isAbolute`.
We found that is-absolute demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.